package be.ac.ua.ecampus.uacmat.entity;

import java.sql.SQLException;
import java.util.Collection;
import java.util.HashSet;
import java.util.Vector;

import be.ac.ua.ecampus.uacmat.QueryHandler;

public class Syllabus extends Entity{
    private double fPrice;
    private String fAcademicYear;
    private boolean fAvailable;
    private int fNumber;
    private Collection<String> fCampuses;
    private Collection<Course> fCourses;
    
    public Syllabus(String id, double price, String description, String academicYear, boolean available, int number) {
            super("syllabus", id, description);
            this.fPrice = price;
            this.fAcademicYear = academicYear;
            this.fAvailable = available;
            this.fNumber = number;
            this.fCampuses = new HashSet<String>();
            this.fCourses = new HashSet<Course>();
    }
    
    public Collection<String> getCampuses() throws SQLException {
    	if (fCampuses.isEmpty()) {
    		QueryHandler queryHandler = new QueryHandler();
    		fCampuses = queryHandler.getCampusesForSyllabus(this.fId);
    	}
    	return fCampuses;
    }
    
    public Collection<Course> getCourses() throws SQLException {
    	if (fCourses.isEmpty()) {
    		QueryHandler queryHandler = new QueryHandler();
    		fCourses = queryHandler.getCoursesForSyllabus(this.fId);
    	}
    	return fCourses;
    }

    public boolean isAvailable() {
            return fAvailable;
    }

    public void setAvailable(boolean fAvailable) {
            this.fAvailable = fAvailable;
    }

    public double getPrice() {
            return fPrice;
    }

    public void setPrice(double fPrice) {
            this.fPrice = fPrice;
    }

    public String getAcademicYear() {
            return fAcademicYear;
    }

    public void setAcademicYear(String fAcademicYear) {
            this.fAcademicYear = fAcademicYear;
    }
    
    public int getNumber() {
    	return this.fNumber;
    }
    
    public void setNumber(int number) {
    	this.fNumber = number;
    }
}